from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from typing import Optional, Any
from datetime import datetime
from module_admin.annotation.pydantic_annotation import as_query

class InOutModel(BaseModel):
    """
    进退分记录表对应pydantic模型
    """

    model_config = ConfigDict(alias_generator=to_camel, from_attributes=True)

    id: Optional[int] = Field(default=None, description='ID')
    m_id: Optional[int] = Field(default=None, description='机器id')
    Type: Optional[str] = Field(alias='Type', default=None, description='0= 进分 1=退分 2=开分 3=洗分')
    Num: Optional[int] = Field(alias='Num', default=None, description='分数')
    Time: Optional[datetime] = Field(alias='Time', default=None, description='客户端传的时间')
    create_time: Optional[int] = Field(default=None, description='创建时间')

class InOutQueryModel(InOutModel):
    """
    进退分记录表不分页查询模型
    """

    begin_time: Optional[str] = Field(default=None, description='开始时间')
    end_time: Optional[str] = Field(default=None, description='结束时间')


@as_query
class InOutPageQueryModel(InOutQueryModel):
    """
    进退分记录表分页查询模型
    """
    page_num: int = Field(default=1, description='当前页码')
    page_size: int = Field(default=10, description='每页记录数')